home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Alles Voor Internet / Tout Pour Internet
/
alles voor internet.iso
/
MacInternet™
/
Utilities
/
InstallerMaker™
/
InstallerMaker__2.0.2_Installe
/
InstallerMaker™ 2.0.2 Installer
/
InstallerMaker Extensions
/
ICnd Extension
/
HasFPUICnd.c
next >
Wrap
Text File
|
1994-03-23
|
4KB
|
118 lines
/* ****************************************************************
HasFPUICnd.c
Written in Symantec Think C 6.0 by Robert Thorne (rmt).
Translated from the MPW Pascal original
written by Darryl Lovato (dgl)
and Jim Merritt (jam).
Copyright © 1994 Aladdin Systems, Inc.
All Rights Reserved.
This source text produces an ICnd
installer extension, which can be called by a Product
Installer during the installation process. Specifications
for IBeg, IMid, ICnd, and IEnd extensions are given in the
documentation for StuffIt InstallerMaker™ 2.0. Note that this
code should be built into a code resource of type 'ICnd' with
a resource ID of 128
This subroutine checks whether the Mac running a product installer
has an FPU unit installed. Custom Condition Bit 0 requests a check
for the FPU being present; Custom Condition Bit 1 requests a check for
the FPU's absense. It works as follows:
(1) if Custom Condition Bit 0 is set:
• Returns 0 (i.e., install the associated item) if the FPU is present.
• Returns 1 (i.e., do NOT install the associated item) if
the FPU is NOT present.
(2) if Custom Condition Bit 1 is set:
• Returns 0 (i.e., install the associated item) if the FPU is not present.
• Returns 1 (i.e., do NOT install the associated item) if
the FPU is present.
(3) otherwise, return 0 (i.e., install the current item)
CHANGE HISTORY:
VER DATE ENGR DESCRIPTION
1 93.06.21 dgl Prototype version.
2 93.06.23 jam Added commentary, modified style to
match other source files in the
InstallerMaker suite, increased
portability across various Pascal
compilers, and rearranged logic to
provide for "care/don't care"
interpretation of custom condition
bit 0 setting in the installermaker
archive window.
3 94.03.07 rmt Translated into Think C
4 94.03.23 rmt Converted to IM 2.0 calling conventions.
****************************************************************** */
// Apple Include Files
#include <Types.h>
#include <GestaltEqu.h>
// Installer Constants
#define kSkipThisItem 1
#define kInstallThisItem 0
#define kMaskForCustomBit0 0x0001
#define kMaskForCustomBit1 0x0002
// Constants for our example
#define kHasFPUCustomBit kMaskForCustomBit0
#define kLacksFPUCustomBit kMaskForCustomBit1
// The call to the code resource. In Think C, we call the resource as "main",
// with the following arguments. Note that we return a "short", returning
// either kSkipThisItem if our condition is false, and kInstallThisItem if the
// condition holds, and we can install. The installer passes us a short integer
// that may have some combination of the least significant three bits set. These
// correspond to the three custom condition settings of the main Installer Maker
// screen.
pascal short main ( unsigned short flags, unsigned short packages )
{
long result ;
// First, test if bit 0 is set; if it isn't, we have no objection to installing
// the current item.
// We check to see if the installer is interested in whether an FPU is
// installed; if any other bit is set, or no bit is set, bless the
// installation of the current item and go away.
if ( flags & kHasFPUCustomBit || flags & kLacksFPUCustomBit )
{
// An interesting bit is set; we now test if the FPU is present
if ( Gestalt(gestaltFPUType,&result) == noErr )
{
if ( flags & kHasFPUCustomBit )
return (result != gestaltNoFPU) ?
kInstallThisItem : // We have FPU, so OK
kSkipThisItem ; // We don't
else
return (result == gestaltNoFPU) ?
kInstallThisItem : // We don't have an FPU, so OK
kSkipThisItem ; // We do
}
else
// Gestalt failed for some reason; we assume we don't have an FPU
return (flags & kLacksFPUCustomBit) ?
kInstallThisItem :
kSkipThisItem ;
}
else
// This item doesn't check for FPU, so we give the go-ahead:
return kInstallThisItem ;
}